﻿package mortal.game.view.common.tooltip.tool
{
    import com.gengine.global.*;
    import flash.events.*;
    import flash.utils.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.common.tooltip.*;

    public class ItemClickToolTipUtil extends Object
    {
        private static var _tooltip:ClickToolTip;
        private static var _datas:Dictionary = new Dictionary();

        public function ItemClickToolTipUtil()
        {
            return;
        }// end function

        public static function registerItemData(param1:EventDispatcher, param2:Object) : void
        {
            param1.addEventListener(MouseEvent.CLICK, showTipsHandler);
            _datas[param1] = param2;
            return;
        }// end function

        public static function unRegisterItemData(param1:EventDispatcher, param2:Object) : void
        {
            param1.removeEventListener(MouseEvent.CLICK, showTipsHandler);
            delete _datas[param1];
            return;
        }// end function

        public static function showClickToolTip(param1:int, param2:int, param3:Object) : void
        {
            if (_tooltip == null)
            {
                _tooltip = new ClickToolTip();
            }
            _tooltip.data = param3;
            _tooltip.show(param1, param2);
            return;
        }// end function

        private static function showTipsHandler(event:MouseEvent) : void
        {
            var _loc_2:* = event.target;
            var _loc_3:* = _datas[_loc_2];
            if (_loc_3 == null)
            {
                return;
            }
            showClickToolTip(Global.stage.mouseX, Global.stage.mouseY, _loc_3);
            return;
        }// end function

    }
}
